package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.MemberWalletClientImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.member.dos.MemberWalletDO;
import com.enation.app.javashop.model.security.ScanModuleDTO;
import com.enation.app.javashop.model.security.ScanResult;
import org.springframework.stereotype.Component;

/**
 * 会员预存款相关熔断fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:26
 **/
@Component
public class MemberWalletClientFallbackFactory extends BaseFallbackFactory<MemberWalletClientImpl> {
    @Override
    protected MemberWalletClientImpl fallback() {
        return new MemberWalletClientFallback();
    }

    /**
     * 会员预存款相关熔断
     *
     * @author zs
     * @version v7.0
     * @date 2021-12-21
     * @since v7.2.3
     */
    @Component
    public static class MemberWalletClientFallback implements MemberWalletClientImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public MemberWalletDO getByMemberId(Long memberId) {
            logger.error("查询会员预存款失败");
            return null;
        }

        @Override
        public ScanResult scanModule(ScanModuleDTO scanModuleDTO) {
            logger.error("会员钱包钱包签名数据扫描失败");
            return null;
        }

        @Override
        public void reSign() {
            logger.error("会员钱包数据重新签名失败");
        }

        @Override
        public void repair(Long memberWalletId) {
            logger.error("修复预存款数据失败");
        }
    }
}
